ImagXpress 13 for .NET - User Guide > How To > Process an Image > Remove Redeye |
To reduce the red reflection of the flash seen in the eyes of people in color flash photo images, use one of the following Processor methods:
Manually remove redeye from eyes in the image, using the RemoveRedeye method.
You must define an area to be processed, using the SetArea method prior to using the RemoveRedeye method. |
Automatically remove redeye from eyes in the image, using the AutoRemoveRedeye method.
The AutoRemoveRedeye method will accurately correct red eyes without modifying elements in the photo which are not eyes, in most cases without any intervention.
As with any algorithm, there is a potential for false positives (modifications of areas that are not eyes), or red eyes that are not corrected in some images.
To provide the application with maximum control over this behavior, the AutoRemoveRedeye method returns all areas that have been corrected as a collection of rectangles. The rectangles identify areas in which red-eyes were detected and corrected and a value indicating the confidence that the area corrected was a red eye. This enables the application to set an acceptable level of false positives and optimize red-eye correction.
For example, an application could do the following:
1. Enable the undo method by setting ImageX.UndoEnabled = True.
2. Correct redeyes, by calling Processor.AutoRemoveRedeye, specifying desired eyeshade, desired eye glare and setting UseEditRectangles to False. (When UseEditRectangles is True, previously detected rectangles will be used to correct red eyes. When UseEditRectangles is False, existing rectangles are ignored.) The AutoRemoveRedeye method removes red eyes from the image and sets the rectangles property to the collection of rectangles in which red eyes were detected and corrected.
To correct redeyes without displaying the results, disable paint by setting ImageX.AutoInvalidate = False prior to calling Processor.AutoRemoveRedeye.
3. Search and reverse any false positives
A. Enumerate through the collection of rectangles, starting at "1" through Processor.Redeyes.Count.
B. Determine if a rectangle erroneously identified an area as containing red eyes, either by visual inspection or by determining that confidence values are below the desired threshold.
This threshold could be set by either the application end-user or the application programmer. |
C. Call Processor.Redeyes.RemoveRectangle to delete rectangles associated with any regions that should NOT be corrected.
4. Add red eyes that were not automatically corrected, if any, as follows:
A. Identify any remaining red eyes (visually).
B. Draw a rectangle around the remaining eyes. (Use rubberband, region, or area).
C. Add the rectangle to the rectangle collection, by calling Processor.Redeyes.
5. Modify redeye regions size or position, using the properties within the RedeyeRectangle class.
6. Correct red-eyes and display the image as follows:
A. Undo the previous AutoRemoveRedeye by calling Processor.ImageX.Undo.
B. Enable painting, by setting ImageX.AutoInvalidate = True
C. Correct redeyes, by calling Processor.AutoRemoveRedeye, setting UseEditRectangles to True.